import tkinter as tk
from view import ChangFrame,DeleteFrame,SearchFrame,InsertFrame,StatisticsFrame,SettingFrame,PrintFrame
from PIL import ImageTk,Image
class Mainpage:
    def __init__(self,master):
        self.root=master
        self.root.title("学生成绩发布系统")
        self.root.geometry("1000x4000")
        self.create_page()


    def create_page(self):
        self.change_frame=ChangFrame(self.root)
        self.insert_frame = InsertFrame(self.root)
        self.delete_frame = DeleteFrame(self.root)
        self.search_frame = SearchFrame(self.root)
        self.statistics_frame = StatisticsFrame(self.root)
        self.setting_frame = SettingFrame(self.root)
        self.print_frame = PrintFrame(self.root)



        menubar=tk.Menu(self.root)
        menubar.add_command(label="系统设置",command=self.show_setting)
        menubar.add_command(label="学生查询",command=self.show_search)
        menubar.add_command(label="信息录入",command=self.show_insert)
        menubar.add_command(label="信息删除",command=self.show_delete)
        menubar.add_command(label="信息修改",command=self.show_change)
        menubar.add_command(label="信息统计",command=self.show_statistisc)
        menubar.add_command(label="信息打印",command=self.show_print)
        self.root["menu"]=menubar

    def show_change(self):
        self.change_frame.pack()
        self.insert_frame.pack_forget()
        self.delete_frame.pack_forget()
        self.search_frame.pack_forget()
        self.statistics_frame.pack_forget()
        self.setting_frame .pack_forget()
        self.print_frame .pack_forget()

    def show_insert(self):
        self.insert_frame.pack()
        self.change_frame.pack_forget()
        self.delete_frame.pack_forget()
        self.search_frame.pack_forget()
        self.statistics_frame.pack_forget()
        self.setting_frame.pack_forget()
        self.print_frame.pack_forget()

    def show_delete(self):
        self.delete_frame.pack()
        self.change_frame.pack_forget()
        self.insert_frame.pack_forget()
        self.search_frame.pack_forget()
        self.statistics_frame.pack_forget()
        self.setting_frame.pack_forget()
        self.print_frame.pack_forget()

    def show_search(self):
        self.search_frame.pack()
        self.change_frame.pack_forget()
        self.insert_frame.pack_forget()
        self.delete_frame.pack_forget()
        self.statistics_frame.pack_forget()
        self.setting_frame.pack_forget()
        self.print_frame.pack_forget()

    def show_statistisc(self):
        self.statistics_frame.pack()
        self.change_frame.pack_forget()
        self.insert_frame.pack_forget()
        self.delete_frame.pack_forget()
        self.search_frame.pack_forget()
        self.setting_frame.pack_forget()
        self.print_frame.pack_forget()

    def show_setting(self):
        self.setting_frame.pack()
        self.change_frame.pack_forget()
        self.insert_frame.pack_forget()
        self.delete_frame.pack_forget()
        self.search_frame.pack_forget()
        self.statistics_frame.pack_forget()
        self.print_frame.pack_forget()

    def show_print(self):
        self.print_frame.pack()
        self.change_frame.pack_forget()
        self.insert_frame.pack_forget()
        self.delete_frame.pack_forget()
        self.search_frame.pack_forget()
        self.statistics_frame.pack_forget()
        self.setting_frame.pack_forget()



if __name__=='__main__':
    root=tk.Tk()
    Mainpage(root)
    root.mainloop()